#ifndef GLRENDERENGINE_H
#define GLRENDERENGINE_H

#include "Framework/Prerequisites.h"
#include "Graphics/IRenderEngine.h"
#include "Graphics/OpenGL/GLPrerequisites.h"

namespace tyro
{
	namespace Graphics
	{
		class GLRenderEngine : public IRenderEngine
		{
		public:

			GLRenderEngine();
			  ~GLRenderEngine();

			  void Update();
			  IRenderWindow* Initialise(const char* const title = "tyro");

			  void ClearFrameBuffer( UINT32 bufferFlags, const Colour& colour = Colour::White, FLOAT_32 depth = 1.0f, UINT16 stencil = 0.0f);
			  void SetPolygonMode( PolygonMode polygonMode );
			  void SetProjectionMatrix(const Math::Matrix4f& matrix);
			  void SetViewMatrix(const Math::Matrix4f& matrix);
			  void SetWorldMatrices(const Math::Matrix4f* matrices, USHORT_16 numMatrices);
			  void SetWorldMatrix(const Math::Matrix4f& matrix);
			  void SetDepthBuffer(bool depthTest, bool depthMask);
			  void SetDepthBufferTest(bool enabled);
			  void SetDepthBufferMask(bool enabled);
			  void SetNormaliseNormals(bool enabled);
			  void SetViewPort(IViewport* viewport);
			  void SetCullingMode(CullingMode mode);
			  void SetRenderTarget(IRenderTarget* renderTarget);
			  void SetViewport(IViewport *vp);
			  void SetColour(Graphics::Colour colour);
			  void SetSurfaceParams(const Colour &ambient,
				   const Colour &diffuse, const Colour &specular,
				   const Colour &emissive, FLOAT_32 shininess);
			  void InitDeviceCapabilities();
			  void BlindVertexElementToDevice(const VertexElement& elem, IDeviceVertexBufferSharedPtr vertexBuffer, size_t vertexStart);
			  void SetLightingActive(bool enabled);
			  void SetAmbientLight(FLOAT_32 r, FLOAT_32 g, FLOAT_32 b);

			  void DrawTriangle();
			  void translate(Math::Vector3f vec);

			  void BeginFrame(void);
			  void EndFrame(void);
			  void RenderOperation(const IRenderOperation& op);
			  void MakeGLMatrix( GLfloat gl_mat[16], const Math::Matrix4f& matrix );

		protected:
		private:


		};
	}
}
#endif